package com.timo.redis.receiv;

import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.message.SimpleMessage;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.concurrent.CountDownLatch;

/**
 * @Description: 类的详细说明
 * @Author: timo
 * @Date: 2019/8/29 11:04
 */
@Slf4j

public class MessageSubscriber {

    private CountDownLatch latch;

    @Autowired
    public MessageSubscriber(CountDownLatch latch) {
        this.latch = latch;
    }

    public void onMessage(SimpleMessage message, String pattern) {
        log.info("1111111111111111111111111111111111111111");
        log.info("topic :{}     -> received: {}",pattern,message);
        latch.countDown();
    }
}
